/**
 * LoadingScreen is a pseudo-singleton attached by the Application preloader
 * to the stage and covers the application view until removed.  Text can be
 * outputted to the instance using the LoadingScreen.instance.appendText()
 * method.
 * 
 * @author		Scott Steven Rodriguez
 * @link 		http://www.flashsherpa.com
 */
package com.ettractions.kiosk.components
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	public class LoadingScreen extends Sprite
	{
		public static const TEXT_FONT:String = "Arial";
		
		public static const TEXT_MARGIN:uint = 10;		
		
		public static var instance:LoadingScreen;
		
		private var _textField:TextField;
		
		public function LoadingScreen()
		{
			graphics.beginFill(0xFFFFFF);
			graphics.drawRect(0, 0, 1280, 720);
			graphics.endFill();
			
			_textField = TextField(addChild(new TextField()));
			_textField.defaultTextFormat = new TextFormat(TEXT_FONT);
			_textField.autoSize = TextFieldAutoSize.LEFT;
			_textField.selectable = false;
			_textField.x = _textField.y = TEXT_MARGIN;
			
			instance = this;			
		}
		
		public function appendText(text:String):void
		{
			_textField.appendText(text);
		}
	}
}